package priv.yiyuan.example.design.visitor;

import priv.yiyuan.example.design.visitor.node.BinaryExpression;
import priv.yiyuan.example.design.visitor.node.VariableDeclaration;

/**
 * 代码生成访问者
 *
 * @author YiYuan
 * @data 2025/7/30
 * @apoNote
 */
public class CodeGenerationVisitor implements AstVisitor {

    @Override
    public void visit(VariableDeclaration node) {
        System.out.println("Generating code for variable " + node.getName() + " of type " + node.getType());
    }

    @Override
    public void visit(BinaryExpression node) {
        System.out.println("Generating code for binary operation " + node.getOperator());
        node.getLeft().accept(this);
        node.getRight().accept(this);
    }
}
